<% pagination_params = params.merge(:controller => @scaffold_controller, :action => 'update_'+@prefix+'table') %>
<% indicator_params = pagination_params.merge(:action => 'pagination') %>
<% previous_url = url_for(pagination_params.merge(:page => paginator.current.previous)) %>
<% next_url = url_for(pagination_params.merge(:page => paginator.current.next)) %>
<% current_url = url_for(pagination_params.merge(:page => paginator.current)) %>

<script>
  addAjaxTableUrlToHistory('<%= current_url %>')
</script>

<%= loading_indicator_tag indicator_params %>
<%= link_to_remote('Previous', 
        { :url => pagination_params.merge(:page => paginator.current.previous),
	      :before => "addAjaxTableUrlToHistory('#{previous_url}')",
	      :loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
          :update => scaffold_content_id(pagination_params) },
        { :href => previous_url,
          :class => "previous"}) if @paginator.current.previous %>
<%= pagination_ajax_links @paginator, pagination_params %>
<%= link_to_remote('Next', 
        { :url => pagination_params.merge(:page => paginator.current.next),
	      :before => "addAjaxTableUrlToHistory('#{next_url}')",
          :loading => "Element.show('#{loading_indicator_id(indicator_params)}');",
          :update => scaffold_content_id(pagination_params) },
        { :href => next_url,
          :class => "next"}) if @paginator.current.next %>